from abc import ABC, abstractmethod

class Animal(ABC):
    @abstractmethod
    def speak(self):
        pass

class Dog(Animal):
    def speak(self):
        return "汪汪！"

class Cat(Animal):
    def speak(self):
        return "喵喵~"
class AnimalFactory(ABC):
    @abstractmethod
    def create_animal(self):
        pass
class DogFactory(AnimalFactory):
    def create_animal(self):
        return Dog()
class CatFactory(AnimalFactory):
    def create_animal(self):
        return Cat()
def get_animal(AnimalFactory):
    animal = AnimalFactory.create_animal()
    print(animal.speak())
get_animal(DogFactory())
get_animal(CatFactory())